<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="my" uri="/mytags" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>

<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>国家资助数据归档</title>
		<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/asserts/bootstrap-3.3.7-dist/css/bootstrap.min.css"/>
	
		<!-- js插件 -->
		<script src="${pageContext.request.contextPath}/js/jquery-3.2.1.min.js"></script>
		<script src="${pageContext.request.contextPath}/asserts/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
		
        <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/asserts/bootstrapValidate/css/bootstrapValidator.min.css"/>
 	   <script src="${pageContext.request.contextPath}/asserts/bootstrapValidate/js/bootstrapValidator.min.js"></script>
 	   
	<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/asserts/datetimepicker/css/bootstrap-datetimepicker.css"/>
	 	   <script src="${pageContext.request.contextPath}/asserts/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
	<script src="${pageContext.request.contextPath}/asserts/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"></script>
	</head>
	<body>
			<!-- 内容展示区 -->
			 <div>
					<!-- 导航 -->
					<ol class="breadcrumb">
						<li><i class="fa fa-comment"></i>国家资助归档统计</li>
					</ol>
					<div class="container-fluid">
						<!-- 	内容面板 -->
						<div class="panel panel-default">
 
							<div class="panel-body">
								<form id="myform" action="${pageContext.request.contextPath}/datatotal/listcountrysub" method="post"  class="form-horizontal" >
								      <div class="form-group">
								      		<label class="control-label col-md-2">学年(开始时间)：</label>
										<div class="col-md-3" >
											  <input type="text" name="beginDate"  id="beginDate" value="<fmt:formatDate value="${dataTotal.beginDate}" pattern="yyyy-MM-dd" />" data-date-format="yyyy-MM-dd"
         				    			  class="form-control input-inline form_time" placeholder="请选择开始时间"  readonly="readonly">
 
											 
										</div>
										<label class="control-label col-md-2">学年(结束时间)：</label>
										<div class="col-md-3" id="endDate">
											  <input type="text" name="endDate" id="endDate" value="<fmt:formatDate value="${dataTotal.endDate}" pattern="yyyy-MM-dd" />" data-date-format="yyyy-MM-dd"
          						     class="form-control input-inline form_time" placeholder="请选择结束时间" readonly="readonly">
 
										</div>
								      </div>
								      <div class="form-group">
								      	<label class="control-label col-md-2">受助项目：</label>
										<div class="col-md-3">
											  <select id="project" name="project" class="form-control">
											  	<option value="">请选择</option>
											  		<option value="学前教育资助" <c:if test="${dataTotal.project=='学前教育资助' }">selected</c:if>>学前教育资助</option>
											  		<option value="一补" <c:if test="${dataTotal.project=='一补' }">selected</c:if>>一补</option>
											  		<option value="普通高中国家助学金" <c:if test="${dataTotal.project=='普通高中国家助学金' }">selected</c:if>>普通高中国家助学金</option>
											  		<option value="普通高中免学杂费" <c:if test="${dataTotal.project=='普通高中免学杂费' }">selected</c:if>>普通高中免学杂费</option>
											  		<option value="中职国家助学金" <c:if test="${dataTotal.project=='中职国家助学金' }">selected</c:if>>中职国家助学金</option>
											  		<option value="中职免学费 " <c:if test="${dataTotal.project=='中职免学费' }">selected</c:if>>中职免学费 </option>
											  		<option value="城市低保非寄宿生县级资助" <c:if test="${dataTotal.project=='城市低保非寄宿生县级资助'}">selected="selected"</c:if>>城市低保非寄宿生县级资助</option>
													<option value="城市低保高中免学费" <c:if test="${dataTotal.project=='城市低保高中免学费'}">selected="selected"</c:if>>城市低保高中免学费</option>
													<option value="精准扶贫高中复读学生免学费" <c:if test="${dataTotal.project=='精准扶贫高中复读学生免学费'}">selected="selected"</c:if>>精准扶贫高中复读学生免学费</option>
													<option value="精准扶贫高中复读学生助学金" <c:if test="${dataTotal.project=='精准扶贫高中复读学生助学金'}">selected="selected"</c:if>>精准扶贫高中复读学生助学金</option>
													<option value="因疫致贫困学生资助" <c:if test="${dataTotal.project=='因疫致贫困学生资助'}">selected="selected"</c:if>>因疫致贫困学生资助</option>
											  		<option value="大学新生入学资助" <c:if test="${dataTotal.project=='大学新生入学资助'}">selected="selected"</c:if>>大学新生入学资助</option>
													<option value="普通高中滋蕙计划" <c:if test="${dataTotal.project=='普通高中滋蕙计划'}">selected="selected"</c:if>>普通高中滋蕙计划</option>
								
											  </select>
										</div>
										 <label class="control-label col-md-2">学期：</label>
										<div class="col-md-3">
											 	<select id="term" name="term" class="form-control">
													<option value="">请选择</option>
													<option value="2019年秋季学期" <c:if test="${dataTotal.term=='2019年秋季学期' }">selected</c:if>>2019年秋季学期</option>
													<option value="2020年春季学期" <c:if test="${dataTotal.term=='2020年春季学期' }">selected</c:if>>2020年春季学期</option>
											 		<option value="2020年秋季学期" <c:if test="${dataTotal.term=='2020年秋季学期' }">selected</c:if>>2020年秋季学期</option>
													<option value="2021年春季学期" <c:if test="${dataTotal.term=='2021年春季学期' }">selected</c:if>>2021年春季学期</option>
													<option value="2021年秋季学期" <c:if test="${dataTotal.term=='2021年秋季学期' }">selected</c:if>>2021年秋季学期</option>
													<option value="2022年春季学期" <c:if test="${dataTotal.term=='2022年春季学期' }">selected</c:if>>2022年春季学期</option>
													<option value="2022年秋季学期" <c:if test="${dataTotal.term=='2022年秋季学期' }">selected</c:if>>2022年秋季学期</option>
													<option value="2023年春季学期" <c:if test="${dataTotal.term=='2023年春季学期' }">selected</c:if>>2023年春季学期</option>
												</select>
										
										</div>
									
								      </div>
								     
								     <div class="form-group">
								    	 <label class="control-label col-md-2">乡镇：</label>
											<div class="col-md-3">
												 		  <select id="zid" name="zid" class="form-control" onchange="changeZhen(this)">
															<option value="">请选择</option>
														</select>
											</div>
										<label class="control-label col-md-2">所在学校：</label>
										<div class="col-md-3">
											 <select id="schoolname" name="schoolname" class="form-control">
												<option value="">请选择</option>
											</select> 
										</div>
										
									</div>
									 <div class="form-group">
										 <label class="control-label col-md-2">姓名：</label>
										<div class="col-md-3">
											 		<input type="text" id="name" name="name" value="${dataTotal.name}" class="form-control"/>
										</div>
										
										<label class="control-label col-md-2">身份证号：</label>
										<div class="col-md-3">
												<input type="text" id="idcard" name="idcard" value="${dataTotal.idcard }" class="form-control"/>
										</div>
										<div class="col-md-2">
												<button class="btn btn-success" type="submit">查询</button>
												<button class="btn btn-danger"  type="button" onclick="exportExcel()">信息导出</button>
										</div>
									 </div>
								</form>
								 
								<table id="listtable" class="table table-bordered table-striped table-condensed table-hover">
									<tr>
										<th width="1%" rowspan="2">序号</th>
										<th width="5%" rowspan="2">受助项目(详见说明)</th>
										<th width="5%" rowspan="2">学校(幼儿园)名称</th>
										<th width="10%" colspan="6">受助学生信息</th>
 										<th width="8%" colspan="2">受助原因</th>
										<th width="20%" colspan="6">家庭住址(填写户口簿住址)</th>
										<th width="15%" colspan="3">家长(监护人)信息</th>
										<th width="10%" colspan="3">账户信息</th>
									 
									</tr>
									<tr>
										<td>姓名</td>
										<td>性别</td>
										<td>年级(一、二、三)</td>
										<td>班级(1,2,3)</td>
										<td>18位身份证号</td>
										<td>学籍号</td>
										<td>受助类别</td>
										<td>详细原因</td>
										<td>省</td>
										<td>市</td>
										<td>县</td>
										<td>镇</td>
										<td>村(社区、街道)</td>
										<td>组(路)</td>
										<td>家长姓名</td>
										<td>与学生关系</td>
										<td>联系电话</td>
										<td>银行卡或存折号</td>
										<td>银行名称</td>
										<td>资助金额或免学费金额(元)</td>
										
									</tr>
									<c:forEach items="${pageInfo.list}" var="ct" varStatus="vs">
									<tr>
										<td>${vs.index+1}</td>
										<td>${ct.project}</td>
										<td>${ct.schoolname}</td>
										<td><a href="javascript:void(0);" onclick="downInfo(${ct.id})" title="下载资料">${ct.name}</a></td>
										<td>${ct.sex}</td>
										<td>${ct.grade }</td>
										<td>${ct.classes}</td>
										<td>${ct.idcard }</td>
										<td> 
											<c:if test="${fn:length(ct.stucode)>5}">
											<span title="${ct.stucode}">${fn:substring(ct.stucode,0,5)}...</span>	
											</c:if>
											<c:if test="${fn:length(ct.stucode)<=5}">
												${ct.stucode}
											</c:if>
										</td>
										<td>${ct.type}</td>
										<td>${ct.descinfo}</td>
										<td>${ct.province}</td>
										<td>${ct.city}</td>
										<td>${ct.xian}</td>
										<td>${ct.town}</td>
										<td>${ct.country}</td>
										<td>${ct.countrygroup}</td>
										<td>${ct.parentname}</td>
										<td>${ct.relation }</td>
										<td>${ct.phone}</td>
										<td>${ct.bankno}</td>
										<td>${ct.bankname}</td>
										<td><a href="../countrysub/selectById?id=${ct.id}" target="blank" title="详情">${ct.amount}</a>
										 
										</td>
<!-- 										<td> </td> -->
									</tr>
									</c:forEach>
		</table>
								<!-- 	分页 -->
								<my:page prePage="${pageInfo.prePage}" nextPage="${pageInfo.nextPage}"
				 url="${pageContext.request.contextPath}/datatotal/listcountrysub?n=1" totalPage="${pageInfo.pages }" currentPage="${pageInfo.pageNum}"/>
									 
							</div>
						</div><!-- 内容面板 end -->
					</div>
			 </div>
</body>
<script type="text/javascript">
  $(function () {
   
    
/*     $(".form_time").datetimepicker({
    	autoclose: true,//选择后自动关闭当前时间控件
    	isRTL: Metronic.isRTL(), //从左向右显示
    	format: "hh:ii", //只选择到分钟
    	startView : 'day', //起始视图从天开始
    	maxView : 'day', //最大视图从天开始
    	minuteStep:1, //分钟显示的间隔是1
    	pickerPosition: (Metronic.isRTL() ? "bottom-right" : "bottom-left")//控件显示位置
            }); */
           //页面加载时，查询所有的 县
            $.ajax({
				url : 'getAllZhen',
				type : "get",
				dataType : "json",
				success : function(data) {
					 
					$("#zid option:gt(0)").remove();
					for(var i=0;i<data.length;i++){
						var opt = "<option value='"+data[i].id+"'>"+data[i].name+"</optoin>";
						$("#zid").append(opt);
					}
				},
				error : function(xhr) {
					alert(xhr);
				}
			});
     
    $('.form_time').datetimepicker({
        format: 'yyyy-mm-dd',
        language:"zh-CN",
        minView: "month",
        autoclose: true,//选中自动关闭
        todayBtn: true, //显示今日按钮
        clearBtn : true,
        pickerPosition: "bottom-left"
       /*  locale: moment.locale('zh-cn') */
    });
            
            
  
 
 
}); 
  function changeZhen(obj){
		 //ajax  查询 公安县 下所有的镇 
		if(obj.value!=''){
			  $.ajax({
					url : '../ztree/getBaseInfo?pid='+obj.value,
					type : "get",
					dataType : "json",
					success : function(data) {
						if(data!=null){
							$("#schoolname option:gt(0)").remove();
							for(var i=0;i<data.length;i++){
								var opt = "<option value='"+data[i].name+"'>"+data[i].name+"</optoin>";
								$("#schoolname").append(opt);
							}
						}
					},
					error : function(xhr) {
						//alert(xhr.status);
					}
				});
		}	
	 }
  
  
 //下载档案
  function downInfo(id){
	 // alert(id);
	 location.href="downloadCountroyZip?id="+id+"&d="+Math.random();
  }
  
  function exportExcel(){
	  var beginDate = $("#beginDate").val();
	  var endDate = $("#endDate").val();
	  var project = $("#project").val();
	  var term = $("#term").val();
	  var zid = $("#zid").val();
	  var schoolname = $("#schoolname").val();
	  var name = $("#name").val();
	  var idcard = $("#idcard").val();
	  //alert(idcard);
	  
	//  localhost.href="exportCountryExcel"
	//提交表单  改变表单的
	// $("#myform").action="exportCountryExcel";
	 $("#myform").attr("action","exportCountryExcel");
	 $("#myform").submit();
	
	  //获取条件
/* 	  $.ajax({
			type:"post",
			url:"exportCountryExcel",
			data:"beginDate="+beginDate+"&endDate="+endDate
				+"&project="+project+"&term="+term+"&zid="+zid
				+"&schoolname="+schoolname+"&name="+name+"&idcard="+idcard,
		 
			success:function(data){
			 	//alert("==="+data);
			     /*  if(data.status==200){
			    	  //登录成功
			    	  alert(data.msg);
			    	//  location.href="../dataupCountrySub.jsp";
			      }else{
			    	 alert(data.msg);
			      } 
			},error:function(data){
				alert(data);
			}
			
		}); */
  }
 /*  document.documentElement.style.overflowY = 'hidden'; */
</script>
</html>